package com.aounhui.common.entity;

import java.io.Serializable;

public class Result<T> implements Serializable {
    private String msg;
    private int responseCode;
    private T content;
    private String tips;
    public static <T> Result ok(T content) {
        return new Result(content);
    }
    public static Result ok() {
        return new Result(null);
    }
    public static <T> Result build(int responseCode, String msg, T content) {
        return new Result(responseCode, msg, content);
    }
    public static <T> Result error(T content, String tips) {
        return new Result(0, "ERROR", content, tips);
    }
    public static <T> Result error(T content) {
        return new Result(0, "ERROR", content);
    }
    public Result(int responseCode, String msg, T content, String tips) {
        this.responseCode = responseCode;
        this.msg = msg;
        this.content = content;
        this.tips = tips;
    }
    public Result(String msg, String tips) {
        this.responseCode = 0;
        this.msg = msg;
        this.tips = tips;
    }
    public Result(T content) {
        this.responseCode = 1;
        this.msg = "SUCCESS";
        this.content = content;
    }
    public Result(int responseCode, String msg, T content) {
        this.responseCode = responseCode;
        this.msg = msg;
        this.content = content;
    }

    public Result () {

    }
    public String getMsg() {
        return msg;
    }

    public int getResponseCode() {
        return responseCode;
    }

    public T getContent() {
        return content;
    }

    public String getTips() {
        return tips;
    }

}
